<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <component :is="a"></component>
  </div>
  <script src="./vue.global.js"></script>
  <script>
    const { createApp } = Vue;
    const app = createApp({
      data(){
        return {
          a: 'CommonHead2'
        }
      }
    });
   
    const CommonHead1 = {
      template: `
        <div>
          <h1>这是父组件组件1</h1>  
        </div>
      `
    }
    const CommonHead2 = {
      template: `
        <div>
          <h1>这是父组件组件2</h1>  
        </div>
      `
    }
    app.component('CommonHead1', CommonHead1)
    app.component('CommonHead2', CommonHead2)
    app.mount('#app')
  </script>
</body>

</html>